package com.xxl.job.executor;



import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.executor.domain.SysUserVo;

import com.xxl.job.executor.mvc.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Slf4j
@Component
//@RestController
//@RequestMapping("/job")
public class task {

    @Autowired
    private ISysUserService iSysUserService;

    @XxlJob("getUser")
//    @PostMapping("/getUser")
    public ReturnT<String> getUser(String param) {
        long start = System.currentTimeMillis();
        log.info("开始执行[超时回复提醒]任务");
        SysUserVo userVo = SysUserVo.builder().userId("00e32ba604d249e689643c2648876436").build();
        List<String> userIds = iSysUserService.getUser(userVo);
        Set<String> userIdList = new HashSet<>();
        for (String userId : userIds) {
            userIdList.add(userId);
        }
        log.info("执行查询客户数据执行完成:{},用时：{}" , userIdList , (System.currentTimeMillis() - start) + "毫秒");

        return ReturnT.SUCCESS;
    }
}
